package de.szut.pongsim.physics;

public enum Collision {
	
	NONE {
		@Override
		public HorizontalDirection collide(BallFunction func, HorizontalDirection dir, Point at) {
			return dir;
		}
	}, 
	
	PAD_BOTTOM {
		@Override
		public HorizontalDirection collide(BallFunction func, HorizontalDirection dir, Point at) {
			func.lowerRebound(at);
			return dir.toggled();
		}
	},
	
	PAD_MIDDLE {
		@Override
		public HorizontalDirection collide(BallFunction func, HorizontalDirection dir, Point at) {
			func.rebound(at);
			return dir.toggled();
		}
	}, 
	
	PAD_TOP {
		@Override
		public HorizontalDirection collide(BallFunction func, HorizontalDirection dir, Point at) {
			func.upperRebound(at);
			return dir.toggled();
		}
	}, 
	
	SIDE {
		@Override
		public HorizontalDirection collide(BallFunction func, HorizontalDirection dir, Point at) {
			func.rebound(at);
			return dir;
		}
	},	
	
	END {
		@Override
		public HorizontalDirection collide(BallFunction func, HorizontalDirection dir, Point at) {
			return null;
		}
	};
	
	public abstract HorizontalDirection collide(BallFunction func, HorizontalDirection dir, Point at);
}
